# 存放学生姓名
name=[]
# 存放学生两门课程的分数
score1 = []
score2 = []

for i in range(3):
    name.append(input(f"请输入第{i+1}名学生的姓名:"))
    while True:
        score=(int(input(f"请输入第{1}门成绩:")))
        if score< 0 or score > 100:
                 print("成绩必须为 0-100 的整数，请重新输入:")
        else:
            score1.append(score)
            break
    while True:
        score=(int(input(f"请输入第{2}门成绩:")))
        if score< 0 or score > 100:
                 print("成绩必须为 0-100 的整数，请重新输入:")
        else:
            score2.append(score)
            break
print('1. 课程总分与平均分：')
sumscore = [(score1[0]+score1[1]+score1[2]),(score2[0]+score2[1]+score2[2])]
privage = [(score1[0]+score1[1]+score1[2])/3,(score2[0]+score2[1]+score2[2])/3]
for i in range(2):
    print(f'课程{i+1}总分：{sumscore[i]},平均分：{privage[i]}')
print('2. 每门课程最高分：')
maxscore1 = max(score1[0],score1[1],score1[2])
maxscore2 = max(score2[0],score2[1],score2[2])
# minscore1 = min(score2[0],score2[1],score2[2])
# minscore2 = min(score1[0],score1[1],score1[2])
# 存放两门课程分数最高的学生姓名
name1 = []
name2 = []
for i in range(3):
    if score1[i]== maxscore1:
        name1.append(name[i])

print(f'课程1最高分：{maxscore1}({", ".join(name1)})')

for i in range(3):
    if score2[i]== maxscore2:
        name2.append(name[i])

print(f'课程2最高分：{maxscore2}({", ".join(name2)})')

# exc存放成绩优秀的学生姓名 fail存放成绩不及格的学生姓名
exc1 = 0
fail1 = 0
exc2 = 0
fail2 = 0
for i in range(3):
    if score1[i]>=90:
        exc1=exc1+1
    elif score1[i]<60:
        fail1=fail1+1


for i in range(3):
    if score2[i]>=90:
        exc2+=1
    elif score2[i]<60:
        fail2+=1


print('3. 优秀与不及格人数：')
print(f'课程1：优秀{exc1}人，不及格{fail1}人')
print(f'课程2：优秀{exc2}人，不及格{fail2}人')


